

const path = require('path');
const staticImg = path.join(__dirname, 'static');

function ArduinoUnoBlocks(Blockly) {






    Blockly.Blocks['EXT_RGB_LIGHT_RING_BLOCK_1607494529660'] = {
        init: function () {
            this.jsonInit({
                "message0": Blockly.Msg.EXT_RGB_LIGHT_RING_BLOCK_1607494529660,
                "args0": [

                    {
                        "type": "field_dropdown",
                        "name": "pin",
                        "options": [
                            [Blockly.Msg.EXT_RGB_LIGHT_RING_BLOCK_1607494529660_PIN_0, '1'],
                            [Blockly.Msg.EXT_RGB_LIGHT_RING_BLOCK_1607494529660_PIN_1, '2'],
                            [Blockly.Msg.EXT_RGB_LIGHT_RING_BLOCK_1607494529660_PIN_2, '3'],
                            [Blockly.Msg.EXT_RGB_LIGHT_RING_BLOCK_1607494529660_PIN_3, '4'],
                            [Blockly.Msg.EXT_RGB_LIGHT_RING_BLOCK_1607494529660_PIN_4, '5'],
                            [Blockly.Msg.EXT_RGB_LIGHT_RING_BLOCK_1607494529660_PIN_5, '6'],
                            [Blockly.Msg.EXT_RGB_LIGHT_RING_BLOCK_1607494529660_PIN_6, '7'],
                            [Blockly.Msg.EXT_RGB_LIGHT_RING_BLOCK_1607494529660_PIN_7, '8'],
                            [Blockly.Msg.EXT_RGB_LIGHT_RING_BLOCK_1607494529660_PIN_8, '9'],
                            [Blockly.Msg.EXT_RGB_LIGHT_RING_BLOCK_1607494529660_PIN_9, '10'],
                            [Blockly.Msg.EXT_RGB_LIGHT_RING_BLOCK_1607494529660_PIN_10, '11'],
                            [Blockly.Msg.EXT_RGB_LIGHT_RING_BLOCK_1607494529660_PIN_11, '12'],
                            [Blockly.Msg.EXT_RGB_LIGHT_RING_BLOCK_1607494529660_PIN_12, '13'],
                            [Blockly.Msg.EXT_RGB_LIGHT_RING_BLOCK_1607494529660_PIN_13, '14'],
                            [Blockly.Msg.EXT_RGB_LIGHT_RING_BLOCK_1607494529660_PIN_14, '15'],
                            [Blockly.Msg.EXT_RGB_LIGHT_RING_BLOCK_1607494529660_PIN_15, '16'],
                            [Blockly.Msg.EXT_RGB_LIGHT_RING_BLOCK_1607494529660_PIN_16, '17'],
                            [Blockly.Msg.EXT_RGB_LIGHT_RING_BLOCK_1607494529660_PIN_17, '18'],
                            [Blockly.Msg.EXT_RGB_LIGHT_RING_BLOCK_1607494529660_PIN_18, '19'],

                        ]
                    },

                ],
                "colour": "#71BE1E",
                "extensions": ["shape_statement"]
            });
        }
    };



    Blockly.Blocks['EXT_RGB_LIGHT_RING_BLOCK_1607494529773'] = {
        init: function () {
            this.jsonInit({
                "message0": Blockly.Msg.EXT_RGB_LIGHT_RING_BLOCK_1607494529773,
                "args0": [

                    {
                        "type": "input_value",
                        "name": "brightness"
                    },

                ],
                "colour": "#71BE1E",
                "extensions": ["shape_statement"]
            });
        }
    };



    // Blockly.Blocks['EXT_RGB_LIGHT_RING_BLOCK_1607494529947'] = {
    //     init: function () {
    //         this.jsonInit({
    //             "message0": Blockly.Msg.EXT_RGB_LIGHT_RING_BLOCK_1607494529947,
    //             "args0": [

    //                 {
    //                     "type": "input_value",
    //                     "name": "ln"
    //                 },

    //                 {
    //                     "type": "input_value",
    //                     "name": "lb"
    //                 },

    //                 {
    //                     "type": "input_value",
    //                     "name": "le"
    //                 },

    //                 {
    //                     "type": "input_value",
    //                     "name": "duration"
    //                 },

    //                 {
    //                     "type": "input_value",
    //                     "name": "R"
    //                 },

    //                 {
    //                     "type": "input_value",
    //                     "name": "G"
    //                 },

    //                 {
    //                     "type": "input_value",
    //                     "name": "B"
    //                 },

    //             ],
    //             "colour": "#71BE1E",
    //             "extensions": ["shape_statement"]
    //         });
    //     }
    // };

    //rgb颜色
    Blockly.Blocks.EXT_RGB_LIGHT_RING_BLOCK_1607494529947 = {
        init: function () {
            this.setColour("#71BE1E");
            this.appendDummyInput("")
                //.appendField(new Blockly.FieldImage(staticImg+"/RGB Light Ring.svg", 84, 42))
                .appendField(Blockly.Msg.PH_RGBRING1)
            this.appendValueInput("ln", Number)
                .appendField(Blockly.Msg.PH_RGBTOTAL)
            this.appendValueInput("lb", Number)
                .appendField(Blockly.Msg.PH_RGBSTART)
            this.appendValueInput("le", Number)
                .appendField(Blockly.Msg.PH_RGBEND)
            this.appendValueInput("duration", Number)
                .appendField(Blockly.Msg.PH_TIME)
            this.appendValueInput("COLOR", Number)
                .appendField(Blockly.Msg.PH_RGBULTRASONICSETCOLORLED)
            this.setPreviousStatement(true, null);
            this.setNextStatement(true, null);
            this.setTooltip('');
        }
    };

    return Blockly;
}

module.exports = ArduinoUnoBlocks;

